import { S } from '../../s';
import { IPSControl } from '../ipscontrol';
import { IPSDBContainerPortletPart } from './ipsdbcontainer-portlet-part';
import { IPSDBPortletPart } from './ipsdbportlet-part';
import { PSDBPortletPartImpl } from './psdbportlet-part-impl';
import { IPSLayout } from '../layout/ipslayout';

export class PSDBContainerPortletPartImpl
  extends PSDBPortletPartImpl
  implements IPSDBContainerPortletPart
{
  protected contentpscontrol: IPSControl;
  getContentPSControl(): IPSControl | null {
    if (this.contentpscontrol != null) return this.contentpscontrol;
    const value = this.M.getContentPSControl;
    if (value == null) {
      return;
    }
    this.contentpscontrol = this.findPSControl(value);
    return this.contentpscontrol;
  }

  protected pslayout: IPSLayout;
  getPSLayout(): IPSLayout | null {
    return (
      this.pslayout ||
      (this.pslayout = this.fillObjectModel(
        S._298,
        this.M.getPSLayout,
        S._2e8,
      ) as IPSLayout)
    );
  }

  get portletType():
    | 'LIST'
    | 'CHART'
    | 'VIEW'
    | 'HTML'
    | 'TOOLBAR'
    | 'ACTIONBAR'
    | 'CUSTOM'
    | 'APPMENU'
    | 'CONTAINER'
    | 'RAWITEM' {
    return this.M.portletType;
  }
  get cls(): string {
    return 'PSDBContainerPortletPartImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._226 || cls == S._227 || cls == S._ae) return true;
    return super.instanceof(cls);
  }
}
